import os
import shutil


def move_file_together(root_path, target_path):
    if os.path.isdir(root_path):
        list_dir = os.listdir(root_path)
        for tmp_path in list_dir:
            tmp_path = os.path.join(root_path, tmp_path)
            move_file_together(tmp_path, target_path)
    else:
        # suffix_file = os.path.splitext(root_path)[1]
        shutil.copy(root_path, os.path.join(target_path, root_path.split("\\")[-1]))


if __name__ == "__main__":
    move_file_together(r"D:\Project\ShandongMine\VideoSet\Video_New\20220412",
                       r"D:\Project\ShandongMine\VideoSet\Video_New")
